package com.aiju.cash.ui.member;

import android.os.Bundle;
import android.view.View;

import com.aiju.base.activity.BaseTitleActivity;
import com.aiju.cash.R;
import com.aiju.utils.Util;
import com.aiju.widgit.layout.SettingItemTextView;

/**
 * @author: 佐为
 * @date: 2017-02-20 15:59
 * @version: V1.0
 * @Description: 会员积分
 */
public class MemberPointsActivity extends BaseTitleActivity {

    private SettingItemTextView useTextView, statueTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_member_point);
        setCenterTitle("会员积分");

        useTextView = (SettingItemTextView) findViewById(R.id.set_points_use);
        statueTextView = (SettingItemTextView) findViewById(R.id.set_member_statue);


        findViewById(R.id.btn_member_setting).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(MemberPointsSettingActivity.class);
            }
        });
        findViewById(R.id.btn_member_setting1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(MemberPointsSettingActivity.class);
            }
        });


    }

    @Override
    protected void onResume() {
        super.onResume();
        if (mUser.getMPoints() != null && mUser.getMPoints().getStatus().equals("1")) {
            statueTextView.getRightView().setTextColor(Util.getColor(R.color.app_display_color));
            statueTextView.setRightText("已开启");
        } else {
            statueTextView.getRightView().setTextColor(Util.getColor(R.color.app_divider_color));
            statueTextView.setRightText("已关闭");
        }
        String sAgeFormat = getResources().getString(R.string.point);
        useTextView.setRightText(String.format(sAgeFormat, mUser.getMPoints().getUseType()) + "%");
    }
}
